﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CookComputing.XmlRpc;

namespace JeanFish.Blog.XmlRpc
{
    /// <summary>
    /// 定义Blogger的方法。
    /// </summary>
    public interface IBlogger
    {
        /// <summary>
        /// 删除博文。
        /// </summary>
        /// <param name="appKey">应用密钥</param>
        /// <param name="postid">博文编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="publish">是否发布</param>
        /// <returns>删除结果</returns>
        [XmlRpcMethod("blogger.deletePost", Description = "删除博文。")]
        [return: XmlRpcReturnValue(Description = "总是返回true。")]
        bool DeletePost(string appKey, string postid, string username, string password, 
            [XmlRpcParameter( Description = "当可用时，表示是否在博客上发布删除操作。")]
            bool publish);
        /// <summary>
        /// 编辑博文。
        /// </summary>
        /// <param name="appKey">应用键</param>
        /// <param name="postid">博文编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="content">博文内容</param>
        /// <param name="publish">是否发布</param>
        /// <returns>编辑结果</returns>
        [XmlRpcMethod("blogger.editPost", Description = "编辑博文。")]
        [return: XmlRpcReturnValue(Description = "总是返回true。")]
        object EditPost(string appKey, string postid, string username, string password, string content, bool publish);
        /// <summary>
        /// 获取博文分类列表。
        /// </summary>
        /// <param name="blogid">博客编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns>分类列表</returns>
        [XmlRpcMethod("blogger.getCategories", Description = "获取类别列表。")]
        Category[] GetCategories(string blogid, string username, string password);
        /// <summary>
        /// 获取博文。
        /// </summary>
        /// <param name="appKey">应用键</param>
        /// <param name="postid">博文编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns>博文信息</returns>
        [XmlRpcMethod("blogger.getPost", Description = "获取博文。")]
        Post GetPost(string appKey, string postid, string username, string password);
        /// <summary>
        /// 获取最近发表的博文列表。
        /// </summary>
        /// <param name="appKey">应用键</param>
        /// <param name="blogid">博客编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="numberOfPosts">获取博文数量</param>
        /// <returns>博文列表</returns>
        [XmlRpcMethod("blogger.getRecentPosts", Description = "获取最近发表的博文列表。")]
        Post[] GetRecentPosts(string appKey, string blogid, string username, string password, int numberOfPosts);
        /// <summary>
        /// 获取博文模版
        /// </summary>
        /// <param name="appKey">应用键</param>
        /// <param name="blogid">博客编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="templateType">模版类型</param>
        /// <returns>博文模版</returns>
        [XmlRpcMethod("blogger.getTemplate", Description = "获取模版。")]
        string GetTemplate(string appKey, string blogid, string username, string password, string templateType);
        /// <summary>
        /// 获取用户信息。
        /// </summary>
        /// <param name="appKey">应用键</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns>用户信息</returns>
        [XmlRpcMethod("blogger.getUserInfo", Description = "获取用于信息。")]
        UserInfo GetUserInfo(string appKey, string username, string password);
        /// <summary>
        /// 获取用户所属的博客列表。
        /// </summary>
        /// <param name="appKey">应用键</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns>博客列表</returns>
        [XmlRpcMethod("blogger.getUsersBlogs", Description = "获取用户所属的博客列表。")]
        BlogInfo[] GetUsersBlogs(string AppKey, string username, string password);
        /// <summary>
        /// 创建博文。
        /// </summary>
        /// <param name="appKey">应用键</param>
        /// <param name="blogid">博客编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="content">博文内容</param>
        /// <param name="publish">是否发布</param>
        /// <returns>创建博文结果</returns>
        [XmlRpcMethod("blogger.newPost", Description = "创建博文。")]
        [return: XmlRpcReturnValue(Description = "新博文编号")]
        string NewPost(string appKey, string blogid, string username, string password, string content, bool publish);
        /// <summary>
        /// 设置模版。
        /// </summary>
        /// <param name="appKey">应用键</param>
        /// <param name="blogid">博客编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="template">模版</param>
        /// <param name="templateType">模版类型</param>
        /// <returns>设置结果</returns>
        [XmlRpcMethod("blogger.setTemplate", Description = "设置博客模版。")]
        bool SetTemplate(string appKey, string blogid, string username, string password, string template, string templateType);
    }
}
